package util.ip;

import static org.junit.Assert.*;

import org.junit.BeforeClass;
import org.junit.Test;

public class IpRegTest {
	
	public static IpReg ipReg;
	
	@BeforeClass
	public static void init() {
		ipReg = new IpReg();
	}

	@Test
	public void test() {
		String regex = "^172\\.16\\.20[0-8]\\.([2][0-4]\\d|[2][5][0-5]|[01]?\\d?\\d)";
		ipReg.setSrcPattern(regex);
		String ip = "172.16.207.88";
		System.out.println(ipReg.isUserSrc(ip));
	}
	
	@Test
	public void testIsISP() {
		String ip1 = "54.78.66.5";
		boolean b = ipReg.isISP(ip1);
		System.out.println(b);
	}
	
	@Test
	public void testIsP4() {
		String ip4 = "100.63.89.09";
		boolean b= ipReg.isP4(ip4);
		System.out.println(b);
	}
	
	@Test
	public void testIsP5() {
		String ip5 = "214.0.0.0";
		boolean b = ipReg.isP5(ip5);
		System.out.println(b);
	}

}
